﻿
@{
    ViewBag.Title = "ConstructionAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}

@section css {
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <style>

        #location {
            position: absolute;
            z-index: 100;
            width: 10px;
            height: 10px;
            color: red;
            font-weight: bold;
        }

        .div-relative {
            position: relative;
        }

        .div-a {
            position: absolute;
        }

        .table tr td {
            border: none;
        }
        .bootstrap-select .dropdown-menu {
            top: 50px !important;
        }
    </style>
}

<div class="page-content" ng-cloak ng-controller="ConstructionController" ng-init="
     page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     Id='@(Request.QueryString["Id"].IsEmpty() ? "" : Request.QueryString["Id"])';
     Submiting= false;
     GetFormStatusList();
     GetConstructionType();
     GetConstructionLevel();
     GetConstructionDetail(Id);
     GetAllUserList('approve_list');
     GetApproveList(Id);
     ">

    <div class="load" ng-show="Submiting">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg">正在提交...</div>
        </div>
    </div>
    <div class="page-heading">
        <h1>危险作业申请</h1>
        <div class="options">
            <div class="btn-toolbar">

            </div>
        </div>
    </div>
    <ol class="breadcrumb">
        <li><a>主页</a></li>
        <li><a>危险作业</a></li>
        <li class="active"><a>危险作业审核</a></li>
    </ol>
    <form id="HiddenTroubleForm" class="form-horizontal row-border">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-inverse">
                        <div class="panel-heading"><h2>危险作业申请表详细</h2></div>
                        <div class="panel-body">
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>申请部门：</label>
                                <div class="col-sm-4">
                                    <input type="text" ng-model="Contruction.DepartmentName" class="form-control" readonly />
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>外协单位：</label>
                                <div class="col-sm-4">
                                    <select id="sel_companylist" disabled class="selectpicker show-tick form-control" ng-model="Contruction.OutCompanyId" data-live-search="true">
                                        <option value="" selected>请选择外协单位</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>作业区域：</label>
                                <div class="col-sm-4">
                                    <input type="text" value="{{Contruction.ParkName}}-{{Contruction.Place}}" class="form-control" readonly />
                                </div>

                                <label class="col-sm-1 control-label"><b style="color:red;"></b>作业时间：</label>
                                <div class="col-sm-2">
                                    <input class="form-control" value="{{Contruction.StartTime|JSONDate:'yyyy-MM-dd HH:mm'}}" readonly />
                                </div>
                                <div class="col-sm-2">
                                    <input class="form-control" value="{{Contruction.EndTime|JSONDate:'yyyy-MM-dd HH:mm'}}" readonly />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>作业类型：</label>
                                <div class="col-sm-2">
                                    <input type="text" value="{{Contruction.TypeName}}" class="form-control" readonly />
                                </div>
                                <div class="col-sm-2">
                                    <input type="text" ng-model="Contruction.OtherType" class="form-control" placeholder="其他作业类型" readonly />
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>危险等级：</label>
                                <div class="col-sm-2">
                                    <div ng-repeat="x in LevelList" class="checkbox-inline"><label><input type="radio" name="level" disabled ng-checked="x.Id==Contruction.LevelId" /> {{x.LevelName}} </label></div>

                                </div>
                                <div class="col-sm-3">
                                    <label class="control-label" style="color:red;" ng-repeat="x in LevelList" id="{{x.Id}}" ng-show="Contruction.LevelId==x.Id">{{x.Reamrk}}</label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>作业事由：</label>
                                <div class="col-sm-9">
                                    <textarea class="form-control" rows="3" ng-model="Contruction.Reason" readonly></textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>作业环境<br />风险辨识</label>
                                <div class="col-sm-9">
                                    <div ng-repeat="x in RiskList" class="checkbox-inline"><label><input disabled type="checkbox" name="risk" id="risk_{{x.Id}}" />{{x.RiskContent}}</label></div>
                                    <div class="checkbox-inline">
                                        <input style="width:150px;border:none;border-bottom:1px solid grey;border-radius:0px;" type="text" placeholder="其他风险" class="form-control" ng-model="Contruction.OtherRisk" readonly />
                                    </div>
                                </div>

                            </div>

                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>安全防控措施：</label>
                                <div class="col-sm-9">
                                    <div ng-repeat="x in SolutionList" class="checkbox"><label><input disabled type="checkbox" name="risk" id="solution_{{x.Id}}" />{{x.SolutionContent}}</label></div>
                                    <div class="checkbox-inline">
                                        <input style="width:150px;border:none;border-bottom:1px solid grey;border-radius:0px;" type="text" placeholder="其他安全防控措施" class="form-control" ng-model="Contruction.OtherSolution" readonly />
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>安全设施设备：</label>
                                <div class="col-sm-11">
                                    <div ng-repeat="x in EquList" class="checkbox-inline"><label><input disabled type="checkbox" name="equ" id="equ_{{x.Id}}" />{{x.EquName}}</label></div>
                                    <div class="checkbox-inline">
                                        <input style="width:150px;border:none;border-bottom:1px solid grey;border-radius:0px;" type="text" placeholder="其他安全设施设备" class="form-control" ng-model="Contruction.OtherSafetyEqu" readonly />
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>作业人：</label>
                                <div class="col-sm-4">
                                    <select id="sel_workerlist" class="selectpicker show-tick form-control" ng-model="Contruction.Worker" data-live-search="true" multiple disabled>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>监护人：</label>
                                <div class="col-sm-4">
                                    <select id="caretakerlist" class="selectpicker show-tick form-control" ng-model="Contruction.Caretakers" data-live-search="true" multiple disabled>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">附件：<span class="not-null"></span></label>
                                <div class="col-lg-9">
                                    <table class="table table-striped table-bordered table-hover">
                                        <thead>
                                            <tr>
                                                <th style="width:5%">序号</th>
                                                <th style="width:30%">文件名称</th>
                                                <th style="width:10%">文件大小(kb)</th>
                                                <th style="width:10%">操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ng-show="Contruction.FileList.length==0">
                                                <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                            </tr>
                                            <tr ng-repeat="x in Contruction.FileList">
                                                <td ng-bind="$index+1"></td>
                                                <td ng-bind="x.FileName"></td>
                                                <td ng-bind="x.FileSize"></td>
                                                <td>
                                                    <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">操作记录：<span class="not-null"></span></label>
                                <div class="col-lg-9">
                                    <table class="table table-striped table-bordered table-hover">
                                        <thead>
                                            <tr>
                                                <th style="width:5%">序号</th>
                                                <th style="width:10%">节点</th>
                                                <th style="width:10%">操作用户</th>
                                                <th style="width:10%">操作内容</th>
                                                <th style="width:10%">时间</th>
                                                <th style="width:30%">备注</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ng-show="ApproveList.length==0">
                                                <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                            </tr>
                                            <tr ng-repeat="x in ApproveList">
                                                <td ng-bind="$index+1"></td>
                                                <td ng-bind="x.StatusModel.OperateName"></td>
                                                <td ng-bind="x.UserName"></td>
                                                <td ng-bind="x.OperateText"></td>
                                                <td>{{x.OperateTime|JSONDate:'yyyy-MM-dd HH:mm'}}</td>
                                                <td ng-bind="x.Remark"></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row" ng-show="!Contruction.GetStatusDetail.IsApproveComplete">
                <div class="col-lg-12" ng-init="ApproveModel.ApproveTime='@DateTime.Now.ToString("yyyy-MM-dd HH:mm")';ApproveModel.Id=Id;">
                    <div class="panel panel-sky">
                        <div class="panel-heading"><h2>{{Contruction.GetStatusDetail.OperateName}}</h2></div>
                        <div class="panel-body">
                            <form class="form-horizontal">                                
                                <div class="form-group">
                                    <label class="col-sm-1 control-label" ng-cloak>审核人</label>
                                    <div class="col-sm-2">
                                        <input type="text" ng-model="User.UserName" class="form-control" disabled />
                                    </div>
                                    <label class="col-sm-1 control-label" ng-cloak>审核时间</label>
                                    <div class="col-sm-2">
                                        <input type="text" ng-model="ApproveModel.ApproveTime" class="form-control" disabled />
                                    </div>
                                    <label class="col-sm-1 control-label" ng-cloak><a ng-click="ShowTip(Contruction.ApproveNodeDescription);" title="{{Contruction.ApproveNodeDescription}}"><span class="badge badge-default">?</span></a>下一节点</label>
                                    <div class="col-sm-2">
                                        <select ng-model="ApproveModel.NextStatus" class="form-control" ng-change="IsShowChooseUser(ApproveModel.NextStatus,Contruction.ApproveNodes);">
                                            <option selected value="">请选择</option>
                                            <option ng-repeat="x in Contruction.ApproveNodes" value="{{x.NextStatus}}">{{x.StatusName}}</option>
                                        </select>
                                                                            @*<select ng-if="!Contruction.NextStatusDetail.Necessary" ng-model="ApproveModel.IsComplete" class="form-control">
                                                <option selected value="">请选择</option>
                                                <option  value="true">审核流程结束</option>
                                                <option  value="false">{{Contruction.NextStatusDetail.OperateName}}</option>
                                            </select>
                                            <input ng-if="Contruction.NextStatusDetail.Necessary" type="text" class="form-control" readonly value="{{Contruction.NextStatusDetail.OperateName}}"/>*@
                                    </div>
                                    <div class="col-sm-2" ng-show="IsShowChoose">
                                        <select id="approve_list" class="selectpicker show-tick form-control" ng-model="ApproveModel.NextUser" ng-change="refreshOption('approve_list');" data-live-search="true" multiple>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">意见</label>
                                    <div class="col-sm-9">
                                        <textarea type="text" ng-model="ApproveModel.Remark" class="form-control"></textarea>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="panel-footer">
                            <div class="row">
                                <div class="col-md-1"> </div>
                                <div class="col-md-1">   <button class="btn-success btn" ng-click="ApproveConstruction(ApproveModel,true,page);">同意</button></div>
                                <div class="col-md-1">   <button class="btn-warning btn" ng-click="ApproveConstruction(ApproveModel,false,page);">驳回</button></div>
                                <div class="col-md-1">    <a class="btn btn-default btn" href="ConstructionFormPageList?page={{page}}">返回</a></div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>

        <div class="modal fade" id="mapModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog" style="min-width:985px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h2 class="modal-title">园区地图</h2>
                    </div>
                    <div class="modal-body">
                        <div class="div-relative" id="mapContent">
                            <div id="location" style="left:50%;top:50%;">
                                <i class="fa fa-map-marker"></i>
                            </div>
                            <img src="~/Assets/img/web/longhua.jpg" width="950" ng-show="Contruction.FactoryAreaId==1" />
                            <img src="~/Assets/img/web/longhua.jpg" width="950" ng-show="Contruction.FactoryAreaId==2" />
                            <div ng-repeat="location in LocationList">
                                <div class="div-a" ng-style="{'left':location.X+'%','top':location.Y+'%'}">
                                    <div style="font-size:12px; border-radius:4px;cursor:pointer;">
                                        <a class="titlediv" style="color:gainsboro;" title="{{location.BuildingName}}">{{location.SimpleName}}</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <input type="hidden" id="h_XAxis" value="0" />
                        <input type="hidden" id="h_YAxis" value="0" />
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="SelectPosition(Contruction)">确定</button>
                    </div>
                </div>
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
    </form>
</div>

@section Js{
    <script src="~/Assets/js/pg/Construction.js?v=@DateTime.Now.ToString("yyyyMMddHHmm")"></script>
    <script src="~/Assets/js/libs/moment.min.js"></script>
    <script src="~/Assets/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Assets/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Assets/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Assets/js/libs/fileinput.js"></script>
    <script src="~/Assets/js/libs/zh.js"></script>
    <script>
        $('#docfiles').fileinput({
            language: 'zh'
        });
        $("#mapContent").mousedown(function (e) {
            var width = $("#mapContent").width();
            var height = $("#mapContent").height();
            mouseX1 = (e.pageX - $("#mapContent").offset().left) / width;
            mouseY1 = (e.pageY - $("#mapContent").offset().top) / height;
            $("#location").css({ 'left': mouseX1 * 100 + '%', 'top': mouseY1 * 100 + '%' });
            $("#h_XAxis").val(mouseX1);
            $("#h_YAxis").val(mouseY1);
        });

        $("#sel_workerlist").selectpicker({
            noneSelectedText: "选择作业人"
        });
        $("#placelist").selectpicker({
            noneSelectedText: "选择场所"
        });
        $("#caretakerlist").selectpicker({
            noneSelectedText: "选择监护人"
        });
        $("#approve_list").selectpicker({
            noneSelectedText: "选择审批人"
        });
        
       
    </script>
}